<script setup>
import request from './request';
import { ref } from 'vue'
function requestApi1() {
  request.get("/api1").then((res) => {  //http://localhost:8000/api1
    console.log("result", res.data, res.status, res.statusText, res.headers, res.config)
  })
  const abc = requestApi2()
  console.log('abc is',abc);
  
}
function requestDetail() {
  request.get("/detail?id=3&name='LiHua'").then((res) => {
    console.log("result", res.data, res.status, res.statusText, res.headers, res.config)
  })
}
function requestApi2() {
  request.post("/api1",{ username: 'lihua', password: 123456 }).then((res) => {  //http://localhost:8000/api1
  console.log("result", res.data, res.status, res.statusText, res.headers, res.config)
  })
}

</script>

<template>
  <div>

    <button @click="() => {
      requestApi1()
    }">请求接口get</button>

    <button @click="() => {
      requestDetail()
    }">请求detail</button>
    <div>
        <button @click="() => {
      requestApi2()
    }">请求接口post</button>
    </div>
  </div>
  

</template>

<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }

  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }
}
</style>
